<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>测试</title>
  <script type="module">
    import cache from './dist/index.js'
    const temp = new cache({ failureTime: 2000, encryption: true, type: 'local', namespace: 'test', secretKey: '123' })
    temp.set('number', 111, { failureTime: 2000, encryption: true })
    function test () {
      console.log(...arguments)
    }
    temp.on('number', test)
    temp.set('string', '2222')
    let array = [1, 3, 4, 5, 65, 6], obj = { a: 1, b: 2, c: 3 }
    temp.set('array', array)
    console.log(2222)
    temp.set('obj', obj)
    console.log(temp.get('number'))
    setTimeout(() => {
      console.log(2345)
    }, 1200)
    setTimeout(() => {
      console.log(111111111)
      console.log(temp.get('number'))
      temp.set('number', 2222)
    }, 1000)
    setTimeout(() => {
      // debugger
      console.log(22222222)
      console.log(temp.get('number'))
    }, 2000)
    setTimeout(() => {
      console.log(temp.get('number'))
      temp.off('number')
    }, 3000)
    setTimeout(() => {
      console.log(temp.get('number'))
    }, 4000)
    setTimeout(() => {
      console.log(temp.get('number'))
      console.log(temp.store.length)
    }, 5000)
    console.log(temp)
  </script>
</head>

<body>

</body>


</html>